Repository navigation
docs(charts): add a single-series Tooltip story - #14214
Conversation
The Tooltip page showed only grouped cards. In the default card, one
resolved row on a chart with a single primary series shows the x value
as its heading and a bare value below it, with no series label and no
color swatch. Readers had no story that shows it.
A fixed "Single series" story on the Tooltip page now shows that card
on the existing monthly revenue dataset, with currency('$') as the
series' value format and the left axis's tick format. Its description
says what differs from the grouped card and why. It documents current
behavior and adds no rule. Its controls are off. The page's Docs intro
points to it next to the grouped rows.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
The new Single series story is approved pending CI: the heavy CI suites have not finished on this head yet.
Hovered at Apr, the story shows the card the description promises: "Apr" and "$95.8K", with no series label and no swatch, in light and dark at 1280 px and 390 px. The grouped Default card is unchanged. No changes are requested.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claims
- Before this change, the Tooltip page showed only multi-series cards: verified (every existing story draws two or three series).
- The page now has a fixed single-series example with its controls off, next to the grouped ones: verified.
- The default card shows a bare value when it has one row and the chart has one primary series: verified in
ChartTooltip.tsx. - The primary-series count leaves out utility marks: verified in
tooltip.tsand the utility mark list. - The draft ChartTooltip record's FR3 and its Single series state describe the same card: verified.
- The pull request documents current behavior only, edits no record and adds no rule: verified (one story file).
- The story id is
charts-chrome-tooltip--single-series: verified in the head Storybook index. - The story uses the monthly revenue data, one Revenue line, and
currency('$')for the value and the left axis: verified. - The story text (bare value, labelled rows with two or more primary series even when one row resolves, utility marks not counted, custom render bodies out of scope) matches the code and the existing unit tests: verified.
- "Single series" uses sentence case like the other explicit story names on the Charts pages: verified (all 15 explicit names on those pages).
- The Docs intro gains one sentence: verified.
- The only other edits are the appended story and one more data import: verified.
- There is no component, API or default change, and no changeset is needed: verified.
- Real-Chrome checks of the new story at Apr in four configurations: reported; reproduced here in all four.
- A mutated build fails the same check: reported.
- Default at Apr matches main in four configurations: reported; reproduced here at 1280 px light, pixel-identical.
- The five existing stories render the same chart markup as main: reported; their code is unchanged.
- The story list gains exactly one id, and none is removed or renamed: verified (Storybook index, base against head).
- The existing play functions pass: reported.
- Storybook build and story-tree test pass: reported.
- Storybook typecheck passes: verified here, and CI's typecheck passes.
- Prettier and ESLint pass on the changed file: verified here, and CI's lint passes.
- The pre-review script reports 0 findings: reported.
- The new story has no play function, so CI does not check its card text: verified.
- The single-row layout rule is covered by
ChartTooltip.test.tsx: verified (its one-series, utility-mark and keyless-series cases; 43 tests pass here).
- Files
apps/storybook/stories/charts/Tooltip.stories.tsx: clear
Reader impact
Engineers who use
<Chart tooltip>saw only grouped cards on the Tooltip page. They had no example of the card a chart with one primary series gets, so they could not tell what changes when a chart draws a single series. After this change, the page has a fixed example of that card next to the grouped ones.Source of truth
The current code:
packages/charts/src/ChartTooltip.tsx, the default card renders a bare value whenrows.length === 1 && !labelRows.labelRowsishasMultiplePrimarySeries(series)inpackages/charts/src/tooltip.ts, which leaves utility marks out of the count.The draft
component:ChartTooltiprecord (FR3 and its "Single series" state row) describes the same card. This pull request documents current behavior only. It edits no record and adds no rule.Correction
A new story on
Charts/Chrome/Tooltip: Single series (charts-chrome-tooltip--single-series). It is a fixed example with its controls disabled.monthlyRevenueDataas oneline()series labelled "Revenue", withcurrency('$')as itsformatValueand as the left axis'sformatTick.renderbodies._dataimport.No component, API or default changes. No changeset: story-only.
Evidence
Screenshots not attached.
hasMultiplePrimarySeriescounts> 0instead of> 1fails that same check in all four configurations. The card then shows a "Revenue" label and one swatch.mainbaseline in all four configurations: "Apr", "Revenue 61", "Costs 38", "Trend 48", and three swatches.main, at 1280 px light only. Per-render ids are normalized.Scope
Components: ChartTooltip
Testing
Author-run checks:
build-storybookandstory-tree.test.ts: pass.tsc: pass.prettier --checkandeslint --max-warnings=0on the changed file: pass.pnpm review:pre --head HEAD: 0 findings.Coverage limit: the new story has no play function, so CI does not check its card text. The single-row layout rule is covered by
packages/charts/src/ChartTooltip.test.tsx.